package com.xujicheng.designpattern.learn.simpleFactory;

/**
 * 简单工厂类，根据类型生产子类实例对象
 * @project:design-pattern-learn
 * @package:com.xujicheng.designpattern.learn.simpleFactory
 * @author:xujicheng
 * @date:2018/8/7
 */
public class SimplePizzaFactory {

    public Pizza createPizza(String type){
        Pizza pizza = null;
        switch (type){
            case "cheese" : pizza = new CheesePizza();
            case "veggie" : pizza = new VeggiePizza();
        }
        return pizza;
    }
}
